/*
 	Software Author: Mike Moore
 	Vectrics Flashrecruit
 	Open source job board and applicant tracking system.  Built with enterprise Java.
 	GPL License applies to this source code.
 */
package org.vectrics.struts;

/**
 * @author Mike Moore
 */
import org.apache.log4j.Category;
import org.vectrics.common.html.Combo;

public abstract class VectricsComboTag extends VectricsTagSupport {

	private static final long serialVersionUID = 219482520643121047L;
	
	static private Category log = Category.getInstance(VectricsComboTag.class);
    private String styleClass = null;
    private String property = null;
	private String selected = null;

    
    public VectricsComboTag() {
    	super();
    }

	protected abstract void makeOptions(Combo combo);

	
	public final String makeStartTag() {
		log.debug("doStartTag() called");
		if (log.isDebugEnabled())
			log.debug("doStartTag() - selected = " + selected);
		
		Combo select = new Combo();
		select.setName(property);
		if (styleClass != null)
			select.setClass(styleClass);
		else
			select.setStyle("width:250;font-family:verdana,arial,sans serif;font-size=" +
					"10px");
		//HttpSession session = super.pageContext.getSession();
		makeOptions(select);
		
		return(select.toString());
	}


	/**
	 * @return
	 */
	public String getStyleClass() {
		return styleClass;
	}

	/**
	 * @param styleClass
	 */
	public void setStyleClass(String styleClass) {
		this.styleClass = styleClass;
	}

	/**
	 * @return
	 */
	public String getProperty() {
		return property;
	}

	/**
	 * @param property
	 */
	public void setProperty(String property) {
		this.property = property;
	}

	/**
	 * @return
	 */
	public String getSelected() {
		return selected;
	}

	/**
	 * @param selected
	 */
	public void setSelected(String selected) {
		this.selected = selected;
	}
}
